<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'
   'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
  <html xmlns='http://www.w3.org/1999/xhtml'>
    <head>
      <meta http-equiv='content-type' content='text/html; charset=utf-8' />
      <meta name='generator' content='CoverStory' />
      <link rel=StyleSheet href='coverstory.css' type='text/css'>
      <script src='coverstory.js' language='javascript' type='text/javascript'></script>
      <title>ATNetwork.m</title>
    </head>
    <body id='coverstory' onload='coverstory_load()' onunload='coverstory_unload()'>
      <div id='maincontainer'>
        <h1 id='sourcename'>ATNetwork.m</h1>
        <h2 id='sourcepath'>/Users/ankitthakur/Documents/Sample/XCode Tools/ATNetworks/Classes/ATRequestDispatcher/ATNetworks/ATNetwork.m</h2>
        <div id='sourcedate'>15/06/10 6:47 PM</div>
        <div id='filelistcontainer'>
          <div id='filesummary'>35.8% of 1100 lines</div>
          <table id='filetable'>
            <tr id='filelistheader'>
              <th id='filelistheadersource'>Source</th>
              <th id='filelistheaderpercent'>%</th>
            </tr>
            <tr class='fileline'>
<td class='filename'><a href='ATImageDownloader.m.html'>ATImageDownloader.m</a></td>
<td class='filepercent'><span class='filelessthan25percent'>0.00</span></td>
</tr>
<tr class='fileline'>
<td class='filename'><a href='ATImageOperation.m.html'>ATImageOperation.m</a></td>
<td class='filepercent'><span class='filelessthan25percent'>0.00</span></td>
</tr>
<tr class='fileline'>
<td class='filename'><a href='GridView.m.html'>GridView.m</a></td>
<td class='filepercent'><span class='filelessthan25percent'>0.00</span></td>
</tr>
<tr class='fileline'>
<td class='filename'><a href='IconView.m.html'>IconView.m</a></td>
<td class='filepercent'><span class='filelessthan25percent'>0.00</span></td>
</tr>
<tr class='fileline'>
<td class='filename'><a href='NSObject+SBJSON.m.html'>NSObject+SBJSON.m</a></td>
<td class='filepercent'><span class='filelessthan25percent'>0.00</span></td>
</tr>
<tr class='fileline'>
<td class='filename'><a href='NSString+SBJSON.m.html'>NSString+SBJSON.m</a></td>
<td class='filepercent'><span class='filelessthan25percent'>0.00</span></td>
</tr>
<tr class='fileline'>
<td class='filename'><a href='Reachability.m.html'>Reachability.m</a></td>
<td class='filepercent'><span class='filelessthan25percent'>0.00</span></td>
</tr>
<tr class='fileline'>
<td class='filename'><a href='TableViewCell.m.html'>TableViewCell.m</a></td>
<td class='filepercent'><span class='filelessthan25percent'>0.00</span></td>
</tr>
<tr class='fileline'>
<td class='filename'><a href='SBJsonWriter.m.html'>SBJsonWriter.m</a></td>
<td class='filepercent'><span class='filelessthan25percent'>2.63</span></td>
</tr>
<tr class='fileline'>
<td class='filename'><a href='Music.m.html'>Music.m</a></td>
<td class='filepercent'><span class='filelessthan25percent'>7.69</span></td>
</tr>
<tr class='fileline'>
<td class='filename'><a href='SBJSON.m.html'>SBJSON.m</a></td>
<td class='filepercent'><span class='filelessthan35percent'>30.16</span></td>
</tr>
<tr class='fileline'>
<td class='filename'><a href='ATJSONDispatcher.m.html'>ATJSONDispatcher.m</a></td>
<td class='filepercent'><span class='filelessthan45percent'>35.00</span></td>
</tr>
<tr class='fileline'>
<td class='filename'><a href='SBJsonParser.m.html'>SBJsonParser.m</a></td>
<td class='filepercent'><span class='filelessthan55percent'>46.36</span></td>
</tr>
<tr class='fileline'>
<td class='filename'><a href='ATNetworksAppDelegate.m.html'>ATNetworksAppDelegate.m</a></td>
<td class='filepercent'><span class='filelessthan55percent'>50.00</span></td>
</tr>
<tr class='fileline'>
<td class='filename'><a href='SBJsonBase.m.html'>SBJsonBase.m</a></td>
<td class='filepercent'><span class='filelessthan65percent'>60.87</span></td>
</tr>
<tr class='fileline'>
<td class='filename'><a href='ATNetwork.m.html'>ATNetwork.m</a></td>
<td class='filepercent'><span class='filelessthan75percent'>69.89</span></td>
</tr>
<tr class='fileline'>
<td class='filename'><a href='main.m.html'>main.m</a></td>
<td class='filepercent'><span class='filelessthan75percent'>71.43</span></td>
</tr>
<tr class='fileline'>
<td class='filename'><a href='ATIconDownloader.m.html'>ATIconDownloader.m</a></td>
<td class='filepercent'><span class='filelessthan75percent'>72.34</span></td>
</tr>
<tr class='fileline'>
<td class='filename'><a href='TableViewController.m.html'>TableViewController.m</a></td>
<td class='filepercent'><span class='filegoodcoveragepercent'>79.71</span></td>
</tr>
<tr class='fileline'>
<td class='filename'><a href='ATNetworksViewController.m.html'>ATNetworksViewController.m</a></td>
<td class='filepercent'><span class='filegoodcoveragepercent'>89.36</span></td>
</tr>
<tr class='fileline'>
<td class='filename'><a href='ATConnection.m.html'>ATConnection.m</a></td>
<td class='filepercent'><span class='filegoodcoveragepercent'>100.00</span></td>
</tr>

          </table>
        </div>
        <div id='sourcecontainer'>
          <div id='sourcesummary'>Executed 69.9% of 93 lines (65 executed, 93 executable, 248 total lines)</div>
          <table id='sourcetable'>
          <tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>//</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>//  ATNetwork.m</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>//  ATNetworks</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>//</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>//  Created by Ankit Thakur on 18/04/10.</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>//  Copyright _ 2010. All rights reserved.</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>//</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'></td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>#import &quot;ATNetwork.h&quot;</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>#import &quot;ATConnection.h&quot;</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>#import &quot;Reachability.h&quot;</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'></td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>@interface ATNetwork (PRIVATE)</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>Reachability* hostReach;</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>Reachability* internetReach;</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>Reachability* wifiReach;</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>NSInteger connectionTag;</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>+ (NSMutableArray*)connectionsArray;</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>+ (NSMutableArray*)dataArray;</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>+ (NSMutableArray*)callBackTargetArray;</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>+ (NSMutableArray*)callBackSelectorArray;</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'></td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>- (void) closeConnection:(ATConnection *)connection ;</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>- (void) updateInterfaceWithReachability: (Reachability*) curReach;</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>@end</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'></td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'></td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>static NSMutableArray *__callBackTargetArray;</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>static NSMutableArray *__callBackSelectorArray;</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>static NSMutableArray *__connectionsArray;</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>static NSMutableArray *__dataArray;</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'></td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>@implementation ATNetwork</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'></td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'></td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>25</td>
<td class='sourcelinehit'>+ (NSMutableArray*)callBackTargetArray {</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>25</td>
<td class='sourcelinehit'>  @synchronized(self) {</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>25</td>
<td class='sourcelinehit'>    if(!__callBackTargetArray) {</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>1</td>
<td class='sourcelinehit'>      __callBackTargetArray = [[NSMutableArray alloc] init];  </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>    }</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>25</td>
<td class='sourcelinehit'>  }</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>  </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>25</td>
<td class='sourcelinehit'>  return __callBackTargetArray;</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>} </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'></td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>25</td>
<td class='sourcelinehit'>+ (NSMutableArray*)callBackSelectorArray {</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>25</td>
<td class='sourcelinehit'>  @synchronized(self) {</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>25</td>
<td class='sourcelinehit'>    if(!__callBackSelectorArray) {</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>1</td>
<td class='sourcelinehit'>      __callBackSelectorArray = [[NSMutableArray alloc] init];  </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>    }</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>25</td>
<td class='sourcelinehit'>  }</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>  </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>25</td>
<td class='sourcelinehit'>  return __callBackSelectorArray;</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>} </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'></td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>95</td>
<td class='sourcelinehit'>+ (NSMutableArray*)connectionsArray {</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>95</td>
<td class='sourcelinehit'>  @synchronized(self) {</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>95</td>
<td class='sourcelinehit'>    if(!__connectionsArray) {</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>1</td>
<td class='sourcelinehit'>      __connectionsArray = [[NSMutableArray alloc] init];  </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>    }</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>95</td>
<td class='sourcelinehit'>  }</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>  </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>95</td>
<td class='sourcelinehit'>  return __connectionsArray;</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>} </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'></td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>89</td>
<td class='sourcelinehit'>+ (NSMutableArray*)dataArray {</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>89</td>
<td class='sourcelinehit'>  @synchronized(self) {</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>89</td>
<td class='sourcelinehit'>    if(!__dataArray) {</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>1</td>
<td class='sourcelinehit'>      __dataArray = [[NSMutableArray alloc] init];  </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>    }</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>89</td>
<td class='sourcelinehit'>  }</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>  </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>89</td>
<td class='sourcelinehit'>  return __dataArray;</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>} </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'></td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'></td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>- (void) openConnection : (NSString *)urlString withCallBackTarget:(id)target_ withCallBackSelector:(SEL)selector_</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>6</td>
<td class='sourcelinehit'>{</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>//  NSLog(@&quot;start openConnection&quot;);</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>6</td>
<td class='sourcelinehit'>  NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString: urlString]];</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>6</td>
<td class='sourcelinehit'>  ATConnection *connection = [[ATConnection alloc] initWithRequest:request delegate:self startImmediately:YES withTag:[NSString stringWithFormat:@&quot;%d&quot;, connectionTag]];</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>6</td>
<td class='sourcelinehit'>  connectionTag++;</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>6</td>
<td class='sourcelinehit'>  NSMutableData *_data = [NSMutableData dataWithLength:0];</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>  </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>//  NSLog(@&quot;%@&quot;,connection.tag);</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>6</td>
<td class='sourcelinehit'>  [[[self class] connectionsArray] addObject:connection];</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>  </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>6</td>
<td class='sourcelinehit'>  [[[self class] dataArray] addObject:_data];</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>  </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>6</td>
<td class='sourcelinehit'>  [[[self class] callBackTargetArray] addObject:target_];</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>6</td>
<td class='sourcelinehit'>  [[[self class] callBackSelectorArray] addObject:NSStringFromSelector(selector_)];</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'></td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>//  NSLog(@&quot;stop&quot;);</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>}</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'></td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>- (void) closeConnection:(ATConnection *)connection </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>6</td>
<td class='sourcelinehit'>{</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>6</td>
<td class='sourcelinehit'>  if(connection == nil){</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>    </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>0</td>
<td class='sourcelinemissed'>    for (int index = 0; index &lt; [[[self class] callBackTargetArray] count]; index++) {</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>0</td>
<td class='sourcelinemissed'>      id target = [[[self class] callBackTargetArray] objectAtIndex:index];</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>      </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>0</td>
<td class='sourcelinemissed'>      SEL selector = NSSelectorFromString([[[self class] callBackSelectorArray] objectAtIndex:index]);</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>      </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>0</td>
<td class='sourcelinemissed'>      NSMutableData *data = [[[self class] dataArray] objectAtIndex:index];</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>      </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>0</td>
<td class='sourcelinemissed'>      if([target respondsToSelector:selector]) {</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>0</td>
<td class='sourcelinemissed'>        [target performSelector:selector withObject:data];</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>      }</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>    }</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>    </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>    </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>0</td>
<td class='sourcelinemissed'>    [[[self class] callBackSelectorArray] removeAllObjects];</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>0</td>
<td class='sourcelinemissed'>    [[[self class] callBackTargetArray] removeAllObjects];</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>0</td>
<td class='sourcelinemissed'>    [[[self class] dataArray] removeAllObjects];</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>0</td>
<td class='sourcelinemissed'>    [[[self class] connectionsArray] removeAllObjects];</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>    </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>  }</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>  else {</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>//    NSLog(@&quot;start closeConnection&quot;);</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>//    NSLog(@&quot;%@&quot;,connection);</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>//    NSLog(@&quot;%@&quot;,connection.tag);</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>6</td>
<td class='sourcelinehit'>    NSInteger index = [[[self class] connectionsArray] indexOfObject:connection];</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>6</td>
<td class='sourcelinehit'>    [[[self class] connectionsArray] removeObject:connection];</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>    </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>6</td>
<td class='sourcelinehit'>    id target = [[[self class] callBackTargetArray] objectAtIndex:index];</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>    </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>6</td>
<td class='sourcelinehit'>    SEL selector = NSSelectorFromString([[[self class] callBackSelectorArray] objectAtIndex:index]);</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>    </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>6</td>
<td class='sourcelinehit'>    NSMutableData *data = [[[self class] dataArray] objectAtIndex:index];</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>    </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>6</td>
<td class='sourcelinehit'>    if([target respondsToSelector:selector]) {</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>6</td>
<td class='sourcelinehit'>      [target performSelector:selector withObject:data];</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>    }</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>6</td>
<td class='sourcelinehit'>    [[[self class] callBackSelectorArray] removeObjectAtIndex:index];</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>6</td>
<td class='sourcelinehit'>    [[[self class] callBackTargetArray] removeObjectAtIndex:index];</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>6</td>
<td class='sourcelinehit'>    [[[self class] dataArray] removeObjectAtIndex:index];</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>6</td>
<td class='sourcelinehit'>    [connection release];</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>  }</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>  </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>6</td>
<td class='sourcelinehit'>  if([[[self class] callBackSelectorArray] count] == 0){</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>    </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>1</td>
<td class='sourcelinehit'>    [[[self class] callBackSelectorArray] release];</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>1</td>
<td class='sourcelinehit'>    __callBackSelectorArray = nil;</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>  }</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>    </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>  </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>6</td>
<td class='sourcelinehit'>  if([[[self class] callBackTargetArray] count] == 0){</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>1</td>
<td class='sourcelinehit'>    [[[self class] callBackTargetArray] release];</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>1</td>
<td class='sourcelinehit'>    __callBackTargetArray = nil;</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>  }</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>    </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>  </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>6</td>
<td class='sourcelinehit'>  if([[[self class] dataArray] count] == 0){</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>1</td>
<td class='sourcelinehit'>    [[[self class] dataArray] release];</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>1</td>
<td class='sourcelinehit'>    __dataArray = nil;</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>  }</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>    </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>  </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>6</td>
<td class='sourcelinehit'>  if([[[self class] connectionsArray] count] == 0){</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>1</td>
<td class='sourcelinehit'>    [[[self class] connectionsArray] release];</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>1</td>
<td class='sourcelinehit'>    __connectionsArray = nil;</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>  }</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>    </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>  </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>}</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'></td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'></td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>- (void) configureNetworkReachability: (Reachability*) curReach</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>0</td>
<td class='sourcelinemissed'>{</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>0</td>
<td class='sourcelinemissed'>    NetworkStatus netStatus = [curReach currentReachabilityStatus];</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>    </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>0</td>
<td class='sourcelinemissed'>  NSString* statusString= @&quot;&quot;;</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>0</td>
<td class='sourcelinemissed'>    switch (netStatus)</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>    {</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>        case NotReachable:</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>        {</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>0</td>
<td class='sourcelinemissed'>            statusString = @&quot;Access Not Available&quot;;</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>            </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>            //Minor interface detail- connectionRequired may return yes, even when the host is unreachable.  We cover that up here...</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>0</td>
<td class='sourcelinemissed'>      [self closeConnection:nil];</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>0</td>
<td class='sourcelinemissed'>            break;</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>        }</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>            </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>        case ReachableViaWWAN:</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>        {</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>0</td>
<td class='sourcelinemissed'>            statusString = @&quot;Reachable WWAN&quot;;</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>0</td>
<td class='sourcelinemissed'>      break;</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>        }</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>        case ReachableViaWiFi:</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>        {</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>0</td>
<td class='sourcelinemissed'>      statusString= @&quot;Reachable WiFi&quot;;</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>            </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>            break;</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>    }</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>    }</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>    </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>}</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'></td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>- (void) updateInterfaceWithReachability: (Reachability*) curReach</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>0</td>
<td class='sourcelinemissed'>{</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>0</td>
<td class='sourcelinemissed'>    [self configureNetworkReachability: curReach];</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>  </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>}</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'></td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>//Called by Reachability whenever status changes.</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>- (void) reachabilityChanged: (NSNotification* )note</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>0</td>
<td class='sourcelinemissed'>{</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>0</td>
<td class='sourcelinemissed'>  Reachability* curReach = [note object];</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>0</td>
<td class='sourcelinemissed'>  NSParameterAssert([curReach isKindOfClass: [Reachability class]]);</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>0</td>
<td class='sourcelinemissed'>  [self updateInterfaceWithReachability: curReach];</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>}</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'></td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'></td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>#pragma mark -</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>#pragma mark Asynchrous NSURLConnection Methods</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>64</td>
<td class='sourcelinehit'>- (void)connection:(ATConnection *)connection didReceiveData:(NSData *)data {</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'></td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>//  NSLog(@&quot;start didReceiveData&quot;);</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>//  NSLog(@&quot;%@&quot;,connection);</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>//  NSLog(@&quot;%@&quot;,connection.tag);</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>//  NSLog(@&quot;%@&quot;,[[self class] connectionsArray]);</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>64</td>
<td class='sourcelinehit'>  NSInteger index = [[[self class] connectionsArray] indexOfObject:connection];</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>64</td>
<td class='sourcelinehit'>  [[[[self class] dataArray] objectAtIndex:index] appendData:data];</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>}</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'></td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>6</td>
<td class='sourcelinehit'>- (void)connection:(ATConnection *)connection didReceiveResponse:(NSURLResponse *)response {</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>  </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>//  NSLog(@&quot;start didReceiveResponse&quot;);</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>6</td>
<td class='sourcelinehit'>  if(connection == [[[self class] connectionsArray] objectAtIndex:0])</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>  {</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>//    NSLog(@&quot;%@&quot;,response);</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>    </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>  }</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>}</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'></td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>6</td>
<td class='sourcelinehit'>- (void)connectionDidFinishLoading:(ATConnection *)connection {</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>//  NSLog(@&quot;start connectionDidFinishLoading&quot;);</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>6</td>
<td class='sourcelinehit'>  [self closeConnection:connection];</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>  </td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>}</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'></td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>0</td>
<td class='sourcelinemissed'>- (void)connection:(ATConnection *)connection didFailWithError:(NSError *)error {</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>//  NSLog(@&quot;start didFailWithError&quot;);</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'>0</td>
<td class='sourcelinemissed'>  [self closeConnection:connection];</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>}</td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'></td>
</tr>
<tr class='sourceline'>
<td class='sourcelinehitcount'></td>
<td class='sourcelineskipped'>@end</td>
</tr>

          </table>
        </div>
      </div>
    </body>
  </html>